package com.wofish.goods.service.impl;

import java.util.List;

import com.wofish.goods.mapper.ImageAttachMapperExpand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wofish.goods.mapper.ImageAttachMapper;
import com.wofish.goods.domain.ImageAttach;
import com.wofish.goods.service.IImageAttachService;
import com.wofish.common.core.text.Convert;

/**
 * 图片关联 服务层实现
 * 
 * @author wofish
 * @date 2019-06-22
 */
@Service
public class ImageAttachServiceImpl implements IImageAttachService {
	@Autowired
	private ImageAttachMapper imageAttachMapper;

	@Autowired
	private ImageAttachMapperExpand imageAttachMapperExpand;

	/**
     * 查询图片关联信息
     * 
     * @param attachId 图片关联ID
     * @return 图片关联信息
     */
    @Override
	public ImageAttach selectImageAttachById(Long attachId) {
	    return imageAttachMapper.selectImageAttachById(attachId);
	}
	
	/**
     * 查询图片关联列表
     * 
     * @param imageAttach 图片关联信息
     * @return 图片关联集合
     */
	@Override
	public List<ImageAttach> selectImageAttachList(ImageAttach imageAttach) {
	    return imageAttachMapper.selectImageAttachList(imageAttach);
	}
	
    /**
     * 新增图片关联
     * 
     * @param imageAttach 图片关联信息
     * @return 结果
     */
	@Override
	public int insertImageAttach(ImageAttach imageAttach) {
	    return imageAttachMapper.insertImageAttach(imageAttach);
	}

	/**
	 * 批量新增图片关联
	 *
	 * @param list
	 * @return 结果
	 */
	@Override
	public int insertBatchImageAttach(List<ImageAttach> list){
		return imageAttachMapper.insertBatchImageAttach(list);
	}
	
	/**
     * 修改图片关联
     * 
     * @param imageAttach 图片关联信息
     * @return 结果
     */
	@Override
	public int updateImageAttach(ImageAttach imageAttach) {
	    return imageAttachMapper.updateImageAttach(imageAttach);
	}

	/**
     * 删除图片关联对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteImageAttachByIds(String ids) {
		return imageAttachMapper.deleteImageAttachByIds(Convert.toStrArray(ids));
	}

	@Override
	public int deleteImageAttachByGoods(Long goodsId) {
		return imageAttachMapperExpand.deleteImageAttachByGoods(goodsId);
	}
}
